
var http= require('http');

const hostname = '127.0.0.1';
const port=4000;

const server = http.createServer((req,res)=>{  
    console.log(req);
    res.statusCode = 200;
    res.setHeader("Content-Type","text/html;charset=utf-8");
     //返回的内容
     res.end("<h1>你好 hello</h1>");
});
server.listen(port,hostname,()=>{
    console.log(`服务器运行在 http://${hostname}:${port}/`)
});

